home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include "cgilib.h"
-
- void main(int argc, char *argv[])
- {
- /* Variables for the data. */
-
- Dictionary dataDict;
- DictState iter;
-
- /*
- * Print the header required for all CGI scripts
- * that output dynamic text data.
- */
- printf("Content-type: text/plain\n\n");
-
- /*
- * Get the CGI data from the CGI library
- */
-
- dataDict = readParse();
-
- printf("The form data is:\n\n");
-
- /* print the data */
-
- iter = dict_initState(dataDict);
-
- while(dict_nextState(&iter))
- {
- /* See if this is an array, if not, print it */
-
- if(strstr(iter.curNode->key,"A_") == iter.curNode->key)
- {
- Array theArray;
- int i,max;
-
- theArray = (Array) iter.curNode->value;
-
- max = array_count(theArray);
-
- printf("Found a key with multiple values:\n");
-
- for(i=0;i<max;i++)
- {
- /* Add 2 to the key to move past the A_ */
- printf("\t%s = %s\n",iter.curNode->key + 2,
- array_itemAt(theArray,i));
- }
- }
- else
- {
- printf("%s = %s\n",iter.curNode->key, iter.curNode->value);
- }
- }
-
- dict_free(dataDict);
-
- /* End the program */
- exit(0);
- }
-